package org.walklink.common.util;

import org.walklink.common.thread.NamedThreadFactory;

import java.util.concurrent.ScheduledThreadPoolExecutor;

/**
 * 线程工厂工具类
 *
 * @author lidishan
 */
public class ThreadFactoryUtil {

    /**
     * 创建单个schedule定时
     * @param mark 标识
     * @return 定时线程池
     */
    public static ScheduledThreadPoolExecutor newSingleSchedule(String mark) {
        return new ScheduledThreadPoolExecutor(1, new NamedThreadFactory(String.format("%s-threadFactory", mark)));
    }

}
